import {take,call,put,fork} from 'redux-saga/effects';
import getClassifyData from '../servers/serClassify';
function *sagWatchClassify() {
    while (true){
        let action = yield take('CLASSIFY');
        let payload =yield call(getClassifyData,action.data);
        let temPayload=[];
        if (payload.code===200){
            temPayload=payload.data;
            for(let i in temPayload){
                temPayload[i].bActive=false;
            }
        }
        yield put({type:'classify',data:{aClassify:temPayload}});
        if (action.data.success){
            action.data.success(payload);
        }
    }
}
export default [
    fork(sagWatchClassify)
]